/*
 * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved.
 */

#ifndef TCPPORT_H
#define TCPPORT_H
#include <QObject>
#include <windows.h>
#include "TcpPortWork.h"
#include "PortBase.h"
namespace SerialPortClass {
class TcpPort : public PortBase {
    Q_OBJECT
public:
    void ClosePort() override;
    explicit TcpPort(QObject *parent = nullptr);
    ~TcpPort() override;
    bool InitPort(PortBaseInitStru &tcpPortInit) override;
    BOOL StartMonitoring() override;
    void WriteToPort(const char *string, int n) override;
    bool IsThreadAlive() const override;
    void SetMsgId(UINT nMsgId);
    void SetOneTimeReadByte(DWORD readByte) override;
public slots:
    void SlotReadData(WPARAM wParam, LPARAM lParam);
signals:
    void SignalWriteToPort(const char *string, int n);
protected:
    TcpPortWork *tcpPortWork;
    UINT witeThreadMsgId;
    DWORD oneTimeReadByte;
};
}

#endif // TCPPORT_H
